/* GUI CONVERTED from rcrbiq.p (converter v1.76) Fri May  3 13:21:26 2002 */
/* rcrbiq.p - Release Management Customer Schedules                           */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.7.1.4 $                                                       */
/*V8:ConvertMode=Report                                                       */
/* REVISION: 7.4      LAST MODIFIED: 09/13/93       BY: WUG *H109*            */
/* REVISION: 7.4      LAST MODIFIED: 04/14/94       BY: WUG *H345*            */
/* REVISION: 7.4      LAST MODIFIED: 07/05/94       BY: qzl *H427*            */
/* REVISION: 7.4      LAST MODIFIED: 07/13/94       BY: bcm *H427*            */
/* REVISION: 7.4      LAST MODIFIED: 02/03/95       BY: srk *H09T*            */
/* REVISION: 7.4      LAST MODIFIED: 12/30/95       BY: jzs *H0HY*            */
/* REVISION: 8.6      LAST MODIFIED: 10/07/97       BY: bvm *K0MM*            */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane          */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan         */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane   */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* Mark Brown         */
/* Old ECO marker removed, but no ECO header exists *F0PN*                    */
/* Revision: 1.7.1.3     BY: Jean Miller        DATE: 03/22/01  ECO: *P008*   */
/* $Revision: 1.7.1.4 $    BY: Katie Hilbert      DATE: 04/15/02  ECO: *P03J*   */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

/* RETROBILL MASTER INQ */


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdtitle.i "2+ "}

define variable cmmts            like soc_hcmmts label "Comments" no-undo.
define variable rbm_memo         like mfc_logical label "Memo Per Item" no-undo.
define variable rbd_eff_from     as date no-undo.
define variable rbd_eff_to       as date no-undo.
define variable rbd_price_change like mfc_logical format "Price/Change" no-undo.
define variable rbd_amt          as decimal label "Amount"
                                 format "->>>,>>>,>>9.99<<<" no-undo.
define variable rbd_memo_invoice as character no-undo.
define variable begstr           as character no-undo.
define variable i                as integer no-undo.


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1 COLUMN 3 NO-LABEL VIEW-AS TEXT SIZE-PIXELS 1 BY 1
 SKIP(.1)  /*GUI*/
rbm_cust     colon 30
   ad_name      no-label
   rbm_auth     colon 30 label "Amendment Number"
with frame a side-labels width 80 attr-space NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER INITIAL "".
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:HIDDEN in frame a = yes.
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5.  /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

FORM /*GUI*/ 
   rbm_cust     colon 30
   ad_name      no-label
   rbm_auth     colon 30 label "Amendment Number"
   skip(1)
   rbm_eff      colon 25 label "As-of Date"
   rbm_memo     colon 65
   rbm_rsn      colon 25
   cmmts        colon 65
with STREAM-IO /*GUI*/  frame a1 side-labels width 80 attr-space.

/* SET EXTERNAL LABELS */
setFrameLabels(frame a1:handle).

FORM /*GUI*/ 
   cmt_cmmt[1] no-label
with STREAM-IO /*GUI*/  frame cmmts_data down width 80 attr-space
title color normal (getFrameTitle("TRANSACTION_COMMENTS",29)).

{wbrp01.i}

mainloop:
repeat:
   do on error undo, retry with frame a:

      if c-application-mode <> "WEB" then
      prompt-for
            rbm_cust
            rbm_auth
      with frame a editing:

         global_addr = input rbm_cust.

         if frame-field = "rbm_cust" then do:
            {mfnp05.i rbm_mstr rbm_cust yes rbm_cust "input rbm_cust"}
         end.
         else
            if frame-field = "rbm_auth" then do:
            {mfnp05.i rbm_mstr rbm_cust
               "rbm_cust = input rbm_cust"
               rbm_auth "input rbm_auth"}
         end.
         else do:
            status input.
            readkey.
            apply lastkey.
         end.

         if recno <> ? then do:
            find ad_mstr where ad_addr = rbm_cust no-lock.

            display
               rbm_cust
               ad_name
               rbm_auth.
         end.
      end.

      {wbrp06.i &command = prompt-for &fields = "rbm_cust rbm_auth" &frm = "a"}

      if (c-application-mode <> "WEB") or
         (c-application-mode = "WEB" and
         (c-web-request begins 'data')) then do:

         find cm_mstr where cm_addr = input frame a rbm_cust no-lock no-error.
         if not available cm_mstr then do:
            /* Invalid Customer */
            {pxmsg.i &MSGNUM=8111 &ERRORLEVEL=3}
            if c-application-mode = "WEB" then return.
            undo, retry.
         end.

         find ad_mstr where ad_addr = cm_addr no-lock.

         display ad_name.

         if input frame a rbm_auth = "" then do:
            /* Blank not allowed */
            {pxmsg.i &MSGNUM=40 &ERRORLEVEL=3}
            if c-application-mode = "WEB" then return.
            else next-prompt rbm_auth.
            undo, retry.
         end.

         find rbm_mstr using frame a rbm_cust and frame a rbm_auth
         no-lock no-error.

         if not available rbm_mstr then do:
            /* Input data matches no record */
            {pxmsg.i &MSGNUM=73 &ERRORLEVEL=3}
            if c-application-mode = "WEB" then return.
            undo, retry.
         end.

         begstr = string(rbm_cust,"x(8)") + string(rbm_auth,"x(16)").

      end.

      /* OUTPUT DESTINATION SELECTION */
      {gpselout.i &printType = "terminal"
                  &printWidth = 80
                  &pagedFlag = " "
                  &stream = " "
                  &appendToFile = " "
                  &streamedOutputToTerminal = " "
                  &withBatchOption = "no"
                  &displayStatementType = 1
                  &withCancelMessage = "yes"
                  &pageBottomMargin = 6
                  &withEmail = "yes"
                  &withWinprint = "yes"
                  &defineVariables = "yes"}
/*GUI*/ RECT-FRAME:HEIGHT-PIXELS in frame a = FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.

   end.

   {hksimsg.i """" """"}        /*fdn*/

   rbm_memo = substring(rbm_ar_nbr,1,1) = "y".

   display
      rbm_cust
      ad_name
      rbm_auth
      rbm_eff
      rbm_rsn
      rbm_memo
   with frame a1 STREAM-IO /*GUI*/ .

   clear frame cmmts_data all.

   for each cmt_det no-lock where cmt_indx = rbm_cmtindx :
      do i = 1 to 15 on endkey undo mainloop, retry:
         if cmt_cmmt[i] > "" then do:
            display
               cmt_cmmt[i] @ cmt_cmmt[1]
            with frame cmmts_data STREAM-IO /*GUI*/ .
            down 1 with frame cmmts_data.
         end.
      end.
   end.

   for each qad_wkfl no-lock
      where qad_key1 = "rbd_det"
        and qad_key2 begins begstr
   with frame detail width 80:
      find scx_ref where scx_order = qad_charfld[5]
                     and scx_line = integer(qad_charfld[6])
      no-lock no-error.
      assign
         rbd_eff_from     = qad_datefld[1]
         rbd_eff_to       = qad_datefld[2]
         rbd_price_change = qad_charfld[9] = "y"
         rbd_amt          = qad_decfld[1]
         rbd_memo_invoice = qad_charfld[10].

      /* SET EXTERNAL LABELS */
      setFrameLabels(frame detail:handle).

      display
         qad_charfld[1]   @ scx_shipfrom     column-label "Ship-From!Ship-To!Model Yr"
         qad_charfld[3]   @ scx_part         column-label "Item!PO Number!Customer Reference"
         rbd_memo_invoice @ rbd_memo_invoice column-label "Memo Inv!Order!Line"
         rbd_price_change @ rbd_price_change column-label "P/C!Eff From!Eff To" WITH STREAM-IO /*GUI*/ .

      down 1.

      display
         qad_charfld[2] @ scx_shipfrom
         qad_charfld[4] @ scx_part
         qad_charfld[5] @ rbd_memo_invoice
         rbd_eff_from   @ rbd_price_change WITH STREAM-IO /*GUI*/ .

      down 1.

      if available scx_ref then
         display
            scx_modelyr @ scx_shipfrom
            scx_custref @ scx_part WITH STREAM-IO /*GUI*/ .

      display
         qad_charfld[6] @ rbd_memo_invoice
         rbd_eff_to     @ rbd_price_change
         rbd_amt WITH STREAM-IO /*GUI*/ .

   end.

   {mfreset.i}
/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/

   {pxmsg.i &MSGNUM=8 &ERRORLEVEL=1}

end.

{wbrp04.i &frame-spec = a}
